package com.mentaleye.dal.dao.mybatis;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.StudentDisciplineRecordDao;
import com.mentaleye.dal.model.StudentDisciplineRecord;
import com.mentaleye.dal.model.StudentDisciplineRecordExample;
import com.mentaleye.dal.service.StudentDisciplineRecordMapper;

@Repository
public class StudentDisciplineRecordDaoImpl implements StudentDisciplineRecordDao {

	@Autowired
	private StudentDisciplineRecordMapper recordMapper;

	@Override
	public boolean insertRecord(StudentDisciplineRecord record) {
		boolean isSuccess = false;
		int result = this.recordMapper.insert(record);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public boolean insertByList(List<StudentDisciplineRecord> recordList) {
		boolean isSuccess = false;
		int result = this.recordMapper.insertByList(recordList);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}
	
	@Override
	public boolean updateRecord(StudentDisciplineRecord record) {
		boolean isSuccess = false;
		int result = this.recordMapper.updateByPrimaryKey(record);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public List<StudentDisciplineRecord> getListByExample(StudentDisciplineRecordExample example) {
		return this.recordMapper.selectByExample(example);
	}

	@Override
	public List<Map<String,Object>> getListByMap(Map<String, Object> map) {
		return this.recordMapper.getListByMap(map);
	}
	
	@Override
	public List<Map<String, Object>> getClassDisciplineByMap(Map<String, Object> map) {
		return this.recordMapper.getClassDisciplineByMap(map);
	}

	@Override
	public List<StudentDisciplineRecord> getListByMapOrderByStudentId(Map<String, Object> map) {
		return this.recordMapper.getListByMapOrderByStudentId(map);
	}
	
	@Override
	public boolean deleteByExample(StudentDisciplineRecordExample example) {
		boolean isSuccess = false;
		int result = this.recordMapper.deleteByExample(example);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public boolean deleteByWriteTime(Date writeTime) {
		boolean isSuccess = false;
		int result = this.recordMapper.deleteByWriteTime(writeTime);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public boolean deleteBySelective(Map<String, Object> map) {
		boolean isSuccess = false;
		int result = this.recordMapper.deleteBySelective(map);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}
}
